﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace SplashScreenThreaded1 {
    public partial class MainForm : Form {

        public static string SplashTitle = "My Splashscreen";
        //SplashScreenForm sf = new SplashScreenForm();
        //SplashScreenForm sf = new SplashScreenForm("Balls OUT!");

        public MainForm() {
            this.Hide();
            Thread splashthread = new Thread(new ThreadStart(SplashScreen.ShowSplashScreen));
            splashthread.IsBackground = true;
            splashthread.Start();
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e) {
            //SplashScreen.UdpateStatusText("Loading Items!!!");
            //Thread.Sleep(1000);
            //SplashScreen.UdpateStatusTextWithStatus("Success Message", TypeOfMessage.Success);
            //Thread.Sleep(1000);
            //SplashScreen.UdpateStatusTextWithStatus("Warning Message", TypeOfMessage.Warning);
            //Thread.Sleep(1000);
            //SplashScreen.UdpateStatusTextWithStatus("Error Message", TypeOfMessage.Error);
            //Thread.Sleep(1000);
            //SplashScreen.UdpateStatusText("Testing Default Message Color");
            //Thread.Sleep(1000);
            //SplashScreen.UdpateStatusText("Items Loaded..");
            //Thread.Sleep(500);

            SplashScreen.UdpateTitleText(MainForm.SplashTitle + " X");
            for (int i = 0; i <= 10; i++) {
                SplashScreen.UdpateTitleText(MainForm.SplashTitle + "  " + i);
                if (i % 2 == 0) {
                    SplashScreen.UdpateStatusText("Loading...");
                    Thread.Sleep(500);
                } else {
                    SplashScreen.UdpateStatusText("Please wait...");
                    SplashScreen.UdpateBodyText("This splash screen can be reused for various things." + Environment.NewLine +
                        "It's not a DLL, but it's still nice.  Developers can create" + Environment.NewLine +
                        "another instance of this project and roll with it!" + Environment.NewLine + Environment.NewLine +
                        "That is all.. spank you.");
                    Thread.Sleep(500);
                }
            }
            SplashScreen.UdpateStatusText("Initializing!");
            Thread.Sleep(800);

            this.Show();
            SplashScreen.CloseSplashScreen();
            this.Activate();
        }
    }
}
